package com.fashiontextile.admin.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.ToString;

import java.util.List;

/**
 * 字典
 *
 * @author brooke_zb
 */
@Data
@ToString
public class Dict {

    Long did;

    /**
     * 字典值
     */
    String value;

    /**
     * 字典类型
     */
    DictCategory category;

    /**
     * 用于父字典，一对多
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    List<Dict> children;

    /**
     * 用于子字典，一对一
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    Dict parent;

    /**
     * 父字典id
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    Long parentId;
}
